<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>事业合伙人</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<!-- <meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black"> -->
		<link rel="stylesheet" href="/Public/css/mui.min.css">
		<link rel="stylesheet" href="/Public/bs/css/font-awesome.min.css">
		<link rel="stylesheet" href="/Public/layui/css/layui.css">
		<script src="/Public/js/jquery-2.1.1.min.js"></script>
		<script src="/Public/js/datePicker.js"></script>
		<script src="/Public/js/mui.min.js"></script>
		<script src="/Public/layui/layui.js"></script>

		<style>
			html,
			body {
				background-color: #efeff4;
			}
			.mui-bar~.mui-content .mui-fullscreen {
				top: 44px;
				height: auto;
				margin-top: 7rem;
			}
			.mui-pull-top-tips {
				position: absolute;
				top: -20px;
				left: 50%;
				margin-left: -25px;
				width: 40px;
				height: 40px;
				border-radius: 100%;
				z-index: 1;
			}
			.mui-bar~.mui-pull-top-tips {
				top: 24px;
			}
			.mui-pull-top-wrapper {
				width: 42px;
				height: 42px;
				display: block;
				text-align: center;
				background-color: #efeff4;
				border: 1px solid #ddd;
				border-radius: 25px;
				background-clip: padding-box;
				box-shadow: 0 4px 10px #bbb;
				overflow: hidden;
			}
			.mui-pull-top-tips.mui-transitioning {
				-webkit-transition-duration: 200ms;
				transition-duration: 200ms;
			}
			.mui-pull-top-tips .mui-pull-loading {
				/*-webkit-backface-visibility: hidden;
				-webkit-transition-duration: 400ms;
				transition-duration: 400ms;*/
				
				margin: 0;
			}
			.mui-pull-top-wrapper .mui-icon,
			.mui-pull-top-wrapper .mui-spinner {
				margin-top: 7px;
			}
			.mui-pull-top-wrapper .mui-icon.mui-reverse {
				/*-webkit-transform: rotate(180deg) translateZ(0);*/
			}
			.mui-pull-bottom-tips {
				text-align: center;
				background-color: #efeff4;
				font-size: 15px;
				line-height: 40px;
				color: #777;
				display: none;
			}
			.mui-pull-top-canvas {
				overflow: hidden;
				background-color: #fafafa;
				border-radius: 40px;
				box-shadow: 0 4px 10px #bbb;
				width: 40px;
				height: 40px;
				margin: 0 auto;
			}
			.mui-pull-top-canvas canvas {
				width: 40px;
			}
			.mui-slider-indicator.mui-segmented-control {
				background-color: #efeff4;
			}
			.mui-ul{
				width:100%; height: 2.7rem; clear: both; margin:0 auto;padding: 0
			}
			.mui-ul li{
				height: 100%;padding: 0;margin:0;text-align: center;line-height:2.5rem; font-size: 0.9rem;
				list-style: none;float: left;
				margin-left: 0;
				background: #A8A8A8
			}
		.mui-scroll{ height:129rem }
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav" style="background: black">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" style="color:white" href="javascript:void(0)" onclick="javascript:history.go(-1);return false;"></a>
			<h1 class="mui-title" style="color: white;">我的奖金</h1>
		</header>
		<div style="height: 4rem"></div>
		<div style="width: 90%; height:3rem; clear: both; margin: 0 auto;border:none; border:1px solid #efeff4;">
			<!-- <form method="post" style="border:none;" id="fm" action="/index.php/home/wei/tongji"> -->
			<input type="search" class="mui-input-clear" placeholder="按时间检索" id="div1" name="search" style="float: left; border: 1px solid #999; background: #eae0e1; color: #7a3c31; border: none;box-shadow: 2px 2px 8px #999; width: 66%;">
			<button  style="float: left; margin-left: 3%; font-weight: bold; background: #91342c; color:#fff;width:25%; box-shadow: 4px 4px 10px #666;border: none;" onclick="return cha()" id="search1" type="submit" class="mui-btn mui-icon mui-icon-search">
			    查询
			</button>
		    <!-- </form> -->
		    <p style="float: left; color: #6d403d; font-size:16px; margin: 0 auto; margin-top: 0.5rem;  padding: 0;">奖金总额：<span style="color:red;">{$commissions|number_format=2}</span>&nbsp;&nbsp;&nbsp;单日奖金:<span style="color:red;">{$commission|number_format=2}</span></p>
		</div>
		<div class="mui-content">
			<div id="slider" class="mui-slider mui-fullscreen">
				<div id="sliderSegmentedControl" class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
					<div class="mui-scroll" style="width: 100%; background: white;">
						<a class="mui-control-item mui-active" href="#item1mobile" style="width: 33%;">
							一级分销
						</a>
						<a class="mui-control-item" href="#item2mobile" style="width: 34%;">
							二级分销
						</a>
						<a class="mui-control-item" href="#item3mobile" style="width: 33%;">
							三级分销
						</a>
					</div>
					<!-- <div style="width: 100%; height: 3rem;background: yellow;"></div> -->
				</div>
				<div style=" height:2.5rem; margin: 0 auto; background:#f00;color:white;font-weight: bold; clear: both;">
					<ul class="mui-ul">
						<li style="width: 15%;">用户名</li>
						<li style="width: 25%;">技师编号</li>
						<li style="width: 25%;">提成</li>
						<li style="width: 35%;">结算时间</li>
					</ul>
				</div>
				<div class="mui-slider-group" style="clear: both;margin: 0 auto; margin-top:2.3rem;">
					<div id="item1mobile" class="mui-slider-item mui-control-content mui-active">
						<div id="scroll1" class="mui-scroll-wrapper">
							<div class="mui-scroll" data-tab="1" style="">
								<ul class="mui-table-view">
									<script id="list1" type="text/html">
		                                {{#  layui.each(d, function(index, item){ }}

		                                
		                                <li class="mui-table-view-cell mui-media">
		                                    <div class="mui-media-body" style="text-align: center; width: 100%;">
		                                    	<span style="width: 15%; display: block; float: left;height: 1rem; text-align: left;">{{item.register_name == 0?'':item.register_name }}</span>
		                                        <span style="width: 25%; display: block; float: left;">{{item.bind_id}}</span>
		                                        <span style="width: 25%; display: block; float: left;">{{item.money}}</span>
		                                        <span style="width: 35%; display: block; float: right;">{{item.time}}</span>
		                                    </div>
		                                </li>
		                                {{#  }); }}
		                            </script>
								</ul>
							</div>
						</div>
					</div>
					<div id="item2mobile" class="mui-slider-item mui-control-content" style="">
						<div class="mui-scroll-wrapper">
							<div class="mui-scroll" data-tab = "2">
								<ul class="mui-table-view">
									<script id="list2" type="text/html">
		                                {{#  layui.each(d, function(index, item){ }}
		                                <li class="mui-table-view-cell mui-media">
		                                    <div class="mui-media-body" style="text-align: center; width: 100%;">
		                                    	<span style="width: 15%; display: block; float: left;height: 1rem; text-align: left;">{{item.register_name == 0?'':item.register_name }}</span>
		                                        <span style="width: 25%; display: block; float: left;">{{item.bind_id}}</span>
		                                        <span style="width: 25%; display: block; float: left;">{{item.money}}</span>
		                                        <span style="width: 35%; display: block; float: right;">{{item.time}}</span>
		                                    </div>
		                                </li>
		                                {{#  }); }}
		                            </script>
								</ul>
							</div>
						</div>
					</div>
					<div id="item3mobile" class="mui-slider-item mui-control-content" style="">
						<div class="mui-scroll-wrapper">
							<div class="mui-scroll" data-tab="3">
								<ul class="mui-table-view">
									<script id="list3" type="text/html">
		                                {{#  layui.each(d, function(index, item){ }}
										<li class="mui-table-view-cell mui-media">
		                                    <div class="mui-media-body" style="text-align: center; width: 100%;">
		                                    	<span style="width: 15%; display: block; float: left;height: 1rem; text-align: left;">{{item.register_name == 0?'':item.register_name }}</span>
		                                        <span style="width: 25%; display: block; float: left;">{{item.bind_id}}</span>
		                                        <span style="width: 25%; display: block; float: left;">{{item.money}}</span>
		                                        <span style="width: 35%; display: block; float: right;">{{item.time}}</span>
		                                    </div>
		                                </li>　
		                                {{#  }); }}
		                            </script>
								</ul>
							</div>
						</div>
					</div>
				</div>
			</div>
			<nav class="mui-bar mui-bar-tab">
			    <a class="mui-tab-item" href='/index.php/home/Index/index'>
			        <span class="mui-icon mui-icon-home"></span>
			        <span class="mui-tab-label">首页</span>
			    </a>
				<a class="mui-tab-item" href='/index.php/home/Chat/index'>
					<span class="mui-icon mui-icon-chat"></span>
					<span class="mui-tab-label">群聊</span>
				</a>
				<a id="shop" class="mui-tab-item" href="/index.php/Home/Shop/index">
					<span class="mui-icon"><i class="fa fa-shopping-cart" aria-hidden="true"></i></span>
					<span class="mui-tab-label">商城</span>
				</a>
			    <a class="mui-tab-item" href='/index.php/home/Member/index'>
			        <span class=" mui-icon mui-icon-contact"></span>
			        <span class="mui-tab-label">我的</span>
			    </a>
			</nav>
		</div>
		<script src="/Public/js/mui.min.js"></script>
		<script src="/Public/js/mui.pullToRefresh.js"></script>
		<script src="/Public/js/mui.pullToRefresh.material.js"></script>
		<script type="text/javascript">

				$('#back').click(function(){
		        	history.go(-1);
		        })

				var calendar1= new datePicker();
			    calendar1.init({
					'trigger': '#div1', /*按钮选择器，用于触发弹出插件*/
					'type': 'date',/*模式：date日期；datetime日期时间；time时间；ym年月；*/
					'minDate':'1900-1-1',/*最小日期*/
					'maxDate':'2100-12-31',/*最大日期*/
					'onSubmit':function(){/*确认时触发事件*/
						var theSelectData=calendar1.value;
					},
					'onClose':function(){
					}
			    });
		</script>
		<script>

			function cha(){
                var date=$('#div1').val();
                var url="/index.php/home/wei/commission";
                //console.log(url+ '?date=' + date);
            	window.location.href=url+'?date=' + date; 
            	//window.location.reload()
            }

		    mui.init();
		    layui.use('laytpl', function () {
		        var laytpl = layui.laytpl;
		        (function(d) {
		            var p1 = 1;  //分页参数
		            var p2 = 1;  //分页参数
		            var p3 = 1;  //分页参数
		            var date = "{$date}";
		            //alert(date);
		            //阻尼系数
		            var deceleration = mui.os.ios?0.003:0.0009;
		            d('.mui-scroll-wrapper').scroll({
		                bounce: true,
		                indicators: true, //是否显示滚动条
		                deceleration:deceleration
		            });
		            d.ready(function() {
		                //循环初始化所有下拉刷新，上拉加载。
		                d.each(document.querySelectorAll('.mui-slider-group .mui-scroll'), function(index, pullRefreshEl) {
		                    d(pullRefreshEl).pullToRefresh({
		                        up: {
		                            auto: true,
		                            contentnomore:'没有更多数据了',
		                            callback: function() {
		                                var self = this;
		                                var type = $(self.element).data('tab');
		                                //alert(type);
		                                var p;
		                                switch (type) {
		                                    case 1:
		                                        getData({p:p1,type:1,date:date},function (res) {
		                                          	p1++;
		                                            renderData(list1, self, res);
		                                            //console.log(res);
		                                        });
		                                        break;
		                                    case 2:
		                                        getData({p:p2,type:2,date:date},function (res) {
		                                            p2++;
		                                            renderData(list2, self, res);
		                                            //console.log(res);
		                                        });
		                                        break;
		                                    case 3:
		                                        getData({p:p3,type:3,date:date},function (res) {
		                                            p3++;
		                                            renderData(list3, self, res);
		                                            //console.log(res);
		                                        });
		                                        break;
		                                }
		                            }
		                        }
		                    });
		                });

		                //id为dom的id self为当前刷新对象 res为返回的数据
		                function renderData(id, self, res) {
		                	//alert(res.data.length);
		                    if (res.data.length == 0) {
		                        self.endPullUpToRefresh(true);
		                        return;
		                    }
		                    var getTpl = id.innerHTML;
		                    var ul = self.element.querySelector('.mui-table-view');
		                    //console.log(ul);
		                    laytpl(getTpl).render(res.data, function(html){
		                        $(ul).append(html);
		                    });
		                    self.endPullUpToRefresh();
		                }

		                function getData(data,success) {
		                    $.ajax({
		                        type: "POST",
		                        url: '/index.php/Home/wei/getData',
		                        dataType: 'json',
		                        timeout: 10000,
		                        data:data ,
		                        success: success
		                    });
		                }
		            });
		        })(mui);
		    })
		</script>
	</body>

</html>